.\"
.\" FreeBSD pkg - a next generation package for the installation and maintenance
.\" of non-core utilities.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\"
.\"     @(#)pkg.8
.\"
.Dd May 25, 2018
.Dt PKG-CHECK 8
.Os
.Sh NAME
.Nm "pkg check"
.Nd sanity check installed packages
.Sh SYNOPSIS
.Nm
.Sm off
.Fl B | Fl d | Fl s | Fl r
.Sm on
.Op Fl nqvy
.Fl a
.Nm
.Sm off
.Fl B | Fl d | Fl s | Fl r
.Sm on
.Op Fl nqvy
.Op Fl Cgix
.Ar pattern
.Pp
.Nm
.Fl -{shlibs,dependencies,checksums,recompute}
.Op Fl -{dry-run,quiet,verbose,yes}
.Fl -all
.Nm
.Fl -{shlibs,dependencies,checksums,recompute}
.Op Fl -{dry-run,quiet,verbose,yes}
.Op Fl -{case-sensitive,glob,case-insensitive,regex}
.Ar pattern
.Sh DESCRIPTION
.Nm
.Fl B
or
.Nm
.Fl -shlibs
regenerates the library dependency metadata for a package by extracting
library requirement information from the binary ELF files in the package.
.Pp
.Nm
.Fl d
or
.Nm
.Fl -dependencies
checks for and installs missing dependencies.
.Pp
.Nm
.Fl r
or
.Nm
.Fl -recompute
recalculates and sets the checksums of installed packages.
This command should only be used when the administrator has
made modifications that invalidate a package checksum.
Spontaneous checksum problems can indicate data or security problems.
.Pp
.Nm
.Fl s
or
.Nm
.Fl -checksums
detects installed packages with invalid checksums.
An invalid checksum can be caused by data corruption or tampering.
.Sh OPTIONS
These options are supported by
.Nm :
.Bl -tag -width dependencies
.It Fl a , Fl -all
Process all packages.
.It Fl C , Fl -case-sensitive
Use case sensitive standard or regular expression
.Fl ( x )
matching with
.Ar pattern .
.It Fl g , Fl -glob
Treat
.Ar pattern
as a shell glob pattern.
.It Fl i , Fl -case-insensitive
Use case insensitive standard or regular expression
.Fl ( x )
matching with
.Ar pattern .
This is the default unless
.Ev CASE_SENSITIVE_MATCH
has been set to true in
.Pa pkg.conf .
.It Fl n , Fl -dry-run
Only check for missing dependencies, do not install them.
.It Fl v , Fl -verbose
Be verbose.
.It Fl q , Fl -quiet
Suppress most output, except for error messages and data that the
command explicitly requests.
This is primarily intended for scripting use.
.It Fl x , Fl -regex
Treat
.Ar pattern
as a regular expression, using the "modern" or "extended" syntax
described in
.Xr re_format 7 .
.It Fl y , Fl -yes
Assume "yes" when asked for confirmation before installing missing
dependencies.
.El
.Sh ENVIRONMENT
These environment variables affect the execution of
.Nm .
See
.Xr pkg.conf 5
for additional information.
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
.It Ev PKG_DBDIR
.It Ev CASE_SENSITIVE_MATCH
.El
.Sh FILES
See
.Xr pkg.conf 5 .
.Sh EXAMPLES
Regenerate the library dependency metadata of all installed packages
from the library information in each package's binary ELF files:
.Bd -literal -offset indent
pkg check -Ba
.Ed
.Pp
Test for missing dependencies needed by nano, installing any that are
missing:
.Bd -literal -offset indent
pkg check -d nano
.Ed
.Pp
Test the checksums of all installed packages to make sure none are
corrupted:
.Bd -literal -offset indent
pkg check -sa
.Ed
.Sh SEE ALSO
.Xr pkg_printf 3 ,
.Xr pkg_repos 3 ,
.Xr pkg-repository 5 ,
.Xr pkg.conf 5 ,
.Xr pkg 8 ,
.Xr pkg-add 8 ,
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
.Xr pkg-backup 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
.Xr pkg-create 8 ,
.Xr pkg-delete 8 ,
.Xr pkg-fetch 8 ,
.Xr pkg-info 8 ,
.Xr pkg-install 8 ,
.Xr pkg-lock 8 ,
.Xr pkg-query 8 ,
.Xr pkg-register 8 ,
.Xr pkg-repo 8 ,
.Xr pkg-rquery 8 ,
.Xr pkg-search 8 ,
.Xr pkg-set 8 ,
.Xr pkg-shell 8 ,
.Xr pkg-shlib 8 ,
.Xr pkg-ssh 8 ,
.Xr pkg-stats 8 ,
.Xr pkg-update 8 ,
.Xr pkg-updating 8 ,
.Xr pkg-upgrade 8 ,
.Xr pkg-version 8 ,
.Xr pkg-which 8
